/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dao;

import model.dao.util.MySQLDataAccessHelper;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author NHAnh
 */
public class ThamSoDAO {

   public static int laySoLuongSanPhamTrenTrang(int id) {
      int soLuong = -1;
      String sql = "SELECT SOSANPHAMTRENTRANG FROM THAMSO WHERE ID="+id;
      MySQLDataAccessHelper helper = new MySQLDataAccessHelper();
      helper.open();
      ResultSet rs = helper.executeQuery(sql);
      try {
         if (rs.next()) {
            soLuong = rs.getInt("SOSANPHAMTRENTRANG");
         }
      } catch (SQLException ex) {
         System.out.println(ex.getMessage());
      }
      helper.close();
      return soLuong;
   }
}
